Page({
  data: {
    tableList: [],
    chartData: {},
    opts: {
        color: ["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"],
        padding: [5,5,5,5],
        enableScroll: false,
        extra: {
          pie: {
            activeOpacity: 0.5,
            activeRadius: 10,
            offsetAngle: 0,
            labelWidth: 15,
            border: false,
            borderWidth: 3,
            borderColor: "#FFFFFF"
          }
        }
    }
  },
  onReady() {
    this.getServerData();
    this.getList()
  },
  // 获取储存库列表
  getList(){
    let that=this
    wx.$req({
      url: '/wms/warehouse/listContainCurrentCapacity',
      loadingText: '加载中...'
    }).then(res => {
        that.setData({
          tableList:res.data
        })
      })
  },
// 获取统计
  getServerData() {

    let that=this
    wx.$req({
      url: '/wms/transactions/statistics/data',
      loadingText: '加载中...'
    }).then(res => {
      console.log(res.data.sort((a, b) => b.value - a.value))
      let data = {
        series: [
          {
            data: res.data
          }
        ]
      };
        this.setData({ chartData: JSON.parse(JSON.stringify(data)) });
      })
  
    // setTimeout(() => {
    //   let res = {
    //       series: [
    //         {
    //           data: [{"name":"一班","value":50},{"name":"二班","value":30},{"name":"三班","value":20},{"name":"四班","value":18},{"name":"五班","value":8}]
    //         }
    //       ]
    //     };
    //   this.setData({ chartData: JSON.parse(JSON.stringify(res)) });
    // }, 500);
  },
 
})